package com.lsa.letcode.the116.populateNextRight;

import java.io.File;

import org.junit.Test;

import com.lsa.helpers.graph.AdjGraph;
import com.lsa.helpers.graph.TgfGraphFactory;
import com.lsa.letcode.common.LetCodeTestBase;
import com.lsa.letcode.common.TreeLinkNode;
import com.lsa.letcode.common.TreeNode;
import com.lsa.letcode.common.TreeUtils;

public class PopulateNextRightTest extends LetCodeTestBase {
	@Test
	public void test() throws Exception {
		TreeNode n = TreeUtils.fromTgf(this.getClass(), "full15.tgf");
		TreeLinkNode tln = TreeUtils.copyAdaptTree2TreeLinkNode(n);
		Solution s = new Solution();
		s.connect(tln);
		
		AdjGraph<String, String> g = TreeUtils.toAdjGraph(tln);
		File f= new File("data/iview/com/lsa/letcode/the116/populateNextRight/result2.tgf");
		System.out.println(f.getAbsolutePath());
		f.getParentFile().mkdirs();
		TgfGraphFactory.saveGraphAsTgf(g, f.getAbsolutePath());
	}
}
